/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
 */

package com.huawei.fastble.bean;

import ohos.bluetooth.BluetoothRemoteDevice;
import ohos.bluetooth.ble.BlePeripheralDevice;

import java.util.Optional;

/**
 * BluetoothDevice
 *
 * @since 2020-07-22
 */
public class BluetoothDevice {
    /**
     * Bluetooth device name
     */
    private String name;

    private String address;

    private int pairState;

    private BlePeripheralDevice bleDevice;

    private BluetoothRemoteDevice blueRemoteDevice;

    public BluetoothRemoteDevice getBlueRemoteDevice() {
        return blueRemoteDevice;
    }

    public void setBlueRemoteDevice(BluetoothRemoteDevice blueRemoteDevice) {
        this.blueRemoteDevice = blueRemoteDevice;
    }

    public BlePeripheralDevice getBleDevice() {
        return bleDevice;
    }

    public void setBleDevice(BlePeripheralDevice bleDevice) {
        this.bleDevice = bleDevice;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public int getPairState() {
        return pairState;
    }

    public void setPairState(int pairState) {
        this.pairState = pairState;
    }

    private String getDeviceName(BluetoothRemoteDevice remoteDevice) {
        Optional<String> optName = remoteDevice.getDeviceName();
        return optName.orElse(remoteDevice.getDeviceAddr());
    }
}
